﻿using Excel2DbTool.Common;
using Excel2DbTool.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace Excel2DbTool.Helpers
{
    /*
	public class LJZTableMigrater : DbTableMigrater
	{
        public LJZTableMigrater()
		{
		}

		public override void Execute()
		{
			DataTable dt = GetDataWhichNeedInsertToTable();

			for (int i = 0; i < dt.Rows.Count; i++)
			{
				DbRowMapping dbrm = new DbRowMapping();

				for (int j = 0; j < dt.Columns.Count; j++)
				{
					var val = dt.Rows[i][j];
					dbrm.AddFieldMapping(new DbFieldMapping(val));
				}

				DbRowMappings.Add(dbrm);
			}


			InsertDataToDb();
		}

		DataTable GetDataWhichNeedInsertToTable()
		{
			string sql = String.Format("SELECT {0} FROM {1}", getFieldNeedRslove(), ConfigHelper.TableName);
			return SqlHelper.GetInstance().Select(sql);
		}

		String getFieldNeedRslove()
		{
            return string.Join(",", FieldMappings.Keys);
		}

		void InsertDataToDb()
		{
			String insertSql = "";
			SqlHelper.GetInstance().Insert(insertSql);
		}

       
    }
    */
    /*
      -- Create table
    create table BDC_LJZ
    (
      ljzid     VARCHAR2(36) not null,
      zrzid     VARCHAR2(36) not null,
      zrzbdcdyh VARCHAR2(28),
      ljzh      VARCHAR2(20) not null,
      ljzmc     VARCHAR2(50) not null,
      ycjzmj    FLOAT,
      ycdxmj    FLOAT,
      ycqtmj    FLOAT,
      scjzmj    FLOAT,
      scdxmj    FLOAT,
      scqtmj    FLOAT,
      jgrq      DATE,
      fwjg1     VARCHAR2(4),
      fwjg2     VARCHAR2(4),
      fwjg3     VARCHAR2(4),
      fwyt1     VARCHAR2(4),
      fwyt2     VARCHAR2(4),
      fwyt3     VARCHAR2(4),
      zcs       INTEGER,
      dscs      INTEGER,
      dxcs      INTEGER,
      bz        VARCHAR2(1000),
      jzwzt     VARCHAR2(4),
      cjsj      DATE,
      cjr       VARCHAR2(50),
      xgsj      DATE,
      xgr       VARCHAR2(50),
      xmid      VARCHAR2(36)
    )
    tablespace BDCDJ0616
      pctfree 10
      initrans 1
      maxtrans 255
      storage
      (
        initial 128K
        next 8K
        minextents 1
        maxextents unlimited
      );
    -- Add comments to the columns 
    comment on column BDC_LJZ.ljzid
      is '逻辑幢ID';
    comment on column BDC_LJZ.zrzid
      is '自然幢ID';
    comment on column BDC_LJZ.zrzbdcdyh
      is '自然幢不动产单元号';
    comment on column BDC_LJZ.ljzh
      is '逻辑幢号';
    comment on column BDC_LJZ.ljzmc
      is '逻辑幢名称';
    comment on column BDC_LJZ.ycjzmj
      is '预测建筑面积';
    comment on column BDC_LJZ.ycdxmj
      is '预测地下面积';
    comment on column BDC_LJZ.ycqtmj
      is '预测其他面积';
    comment on column BDC_LJZ.scjzmj
      is '实测建筑面积';
    comment on column BDC_LJZ.scdxmj
      is '实测地下面积';
    comment on column BDC_LJZ.scqtmj
      is '实测其他面积';
    comment on column BDC_LJZ.jgrq
      is '竣工日期';
    comment on column BDC_LJZ.fwjg1
      is '房屋结构1';
    comment on column BDC_LJZ.fwjg2
      is '房屋结构2';
    comment on column BDC_LJZ.fwjg3
      is '房屋结构3';
    comment on column BDC_LJZ.fwyt1
      is '房屋用途1';
    comment on column BDC_LJZ.fwyt2
      is '房屋用途2';
    comment on column BDC_LJZ.fwyt3
      is '房屋用途3';
    comment on column BDC_LJZ.zcs
      is '总层数';
    comment on column BDC_LJZ.dscs
      is '地上层数';
    comment on column BDC_LJZ.dxcs
      is '地下层数';
    comment on column BDC_LJZ.bz
      is '备注';
    comment on column BDC_LJZ.jzwzt
      is '建筑物状态';
    comment on column BDC_LJZ.cjsj
      is '创建时间';
    comment on column BDC_LJZ.cjr
      is '创建人';
    comment on column BDC_LJZ.xgsj
      is '修改时间';
    comment on column BDC_LJZ.xgr
      is '修改人';
    comment on column BDC_LJZ.xmid
      is '项目id';
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table BDC_LJZ
      add constraint N_BDC_LJZ_LJZID_PRI primary key (LJZID)
      using index 
      tablespace BDCDJ0616
      pctfree 10
      initrans 2
      maxtrans 255
      storage
      (
        initial 64K
        next 1M
        minextents 1
        maxextents unlimited
      );

 
     */

}
